<template>
	<view class="">
		<u-cell-group>
			<u-cell-item icon="zhuanfa" title="退出登录" @click="goOut"></u-cell-item>
		</u-cell-group>
	</view>
</template>

<script>
	import {URL,BASEURL} from "../../config.js"
export default {
	data() {
		return {
			form: {
				name: '',
				intro: '',
				sex: '',
			},
			radio: '',
			switchVal: false,
			content:""
		};
	},
	methods:{
			 goOut(){
				  let token = uni.getStorageSync('token');
				 	console.log("登录")
				 	uni.request({
				 		url: URL.LOGOUT,
				 		method: 'POST',
				 		data: {},
						header: {
						      "token": token
						    },
				 		success: ({data}) => {
				 			console.log(data)
				 			if(data.code=="0"){
				 				uni.clearStorageSync();
				 				uni.showToast({
				 					title:"退出登录成功",
				 				})
				 				setTimeout(function(){
				 					uni.navigateTo({
				 						url:"../login/login"
				 					})
				 				},1000)
				 			}else{
				 				uni.showToast({
				 					title:data.msg,
				 					icon:"none"
				 				})
				 			}
				 		},
				 		complete: () => {}
				 	});
				 
			 }
		}
};
</script>